#coding: utf-8
module HomeHelper
  def generate_slider(posts)
    return_string = ""
    posts.each do |p|
      if p.thumb_id and Ckeditor::Asset.exists?(p.thumb_id)
        return_string += "<li>"
        return_string += "<a href='posts/#{p.id}' title='#{p.title}'>"
        return_string += "<img src='#{Ckeditor::Asset.find(p.thumb_id).url_thumb}' title='#{p.title}' />"
        return_string += "</a></li>"
      end
    end
    return return_string.html_safe
  end
  
end
